import api from "./index"
// 登录
export const getLogin = (params) => api.post('/login', params)
//侧边栏
export const getMenus = (params) => api.get('/menus', params)
//用户所有数据
export const getUsers = (params) => api.get('/users', { params: params })
//修改状态
export const getStatus = (params) => api.put(`users/${params.id}/state/${params.mg_state}`, { params: params })
// 添加
export const getAdd = (params) => api.post('/users', params)
// 删除
export const getDelete = (params) => api.delete(`/users/${params.id}`, { params })
// 编辑
export const getEdit = (params) => api.put(`users/${params.id}`, params)
//用户搜索
export const getSearch = (params) => api.get(`users/`, params)
//分配权限
export const getRole = (params) => api.put(`users/${params.id}/role/`, params)



//所有权限
export const getRoles = (params) => api.get('/roles', { params: params })
//添加角色
export const addRoles = (params) => api.post('/roles', params)
//权限列表
export const getRights = (params) => api.get('/rights/list', params)
//编辑
export const rolesEdit = (params) => api.put(`roles/${params.id}`, params)
// 删除
export const rolesDelete = (params) => api.delete(`roles/${params.id}`, params)
//角色授权列表
export const roleRoles = (params) => api.get('/rights/tree', params)
//授权数据
export const roleRoleId = (params) => api.post(`roles/${params.roleId}/rights`, params)
//删除角色权限
export const rightDelete = (params) => api.delete(`roles/${params.roleId}/rights/${params.rightId}`, params)





// 商品分类三级联动
export const categories = (params) => api.get('categories', params)
// 商品分类参数列表
export const Attcategories = (params) => api.get(`categories/${params.id}/attributes/`, {params})
// 删除分类
export const deleteCategories = (params) => api.delete(`categories/${params.id}/attributes/${params.attrid}`, params)
//添加动态参数和静态参数
export const logCategories = (params) => api.post(`categories/${params.id}/attributes`, params)
//渲染tablle
export const tableCategories = (params) => api.get(`categories/${params.id}/attributes/` + `?sel=${params.sel}`, params)
// 编辑
export const editCategories = (params) => api.put(`categories/${params.id}/attributes/${params.attrid}`, params)






//商品列表数据

//商品列表请求
export const getGoods = (params) => api.get('/goods', { params: params })
//商品添加
export const addGoods = (params) => api.post('/goods', params)
//商品删除
export const shopDelete = (params) => api.delete(`/goods/${params.id}`, { params })
//编辑商品
export const shopGoods = (params) => api.put(`/goods/${params.goods_id}`, params)
//搜索
export const shopSearch = (params) => api.get(`/goods`, { params: params })

//订单
export const getOrders = (params) => api.get(`/orders`, { params: params })
//订单查询
export const ordersSearch = (params) => api.get(`/orders`, { params: params })
//物流信息
export const ordersKuai = (params) => api.get(`/kuaidi/1106975712662`, params)




//数据统计
export const getReports = (params) => api.get('reports/type/1', params)




// 商品分类
export const getCategories = (params) => api.get('categories', params)
//添加分类
export const addCategories = (params) => api.post(`categories/${params}`, params)


// 照片上传
export const uploadd = (params) => api.post('upload', params)